﻿using AutoMapper;
using Microsoft.EntityFrameworkCore;
using Rj_GsInsurance.Server.DataBaseContext;
using Rj_GsInsurance.Server.DataBaseContext.Entities;
using Rj_GsInsurance.Server.Models.InsurMsgDataInput;
using Rj_GsInsurance.Server.Models.InsurMsgDataOutput;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Rj_GsInsurance.Server.Services.Impl
{
    public class GsInsuranceServer : IGsInsuranceServer
    {
        private HisDbContext HisDbContext;
        private IMapper Mapper;

        public GsInsuranceServer(HisDbContext hisDbContext, IMapper mapper)
        {
            HisDbContext = hisDbContext;
            Mapper = mapper;
        }

        public async Task<ObservableCollection<DocUploadInput>> GetDocUploadByExample(Func<InsuranceHbgsDocUpload, bool> example)
        {
            var insur=await HisDbContext.SystemTbWorkers.Where(a=>!HisDbContext.InsuranceHbgsDocUploads.Any(b=>b.Code==a.WorkerId.ToString())).ToListAsync();
            return Mapper.Map<ObservableCollection<DocUploadInput>>(insur);
        }

        public async Task<DownLoadOutput> InsurDown(DownLoadInput input)
        {
            //return await Task.Run(() => {

            //};
            throw new NotImplementedException();
        }
    }
}
